package model

import (
	"github.com/Gre-Z/common/jtime"
	"gorm.io/datatypes"
)

type RequestLog struct {
	Id         int64            `json:"id" gorm:"column:id"`
	Req        datatypes.JSON   `json:"req" gorm:"column:req"`
	Res        datatypes.JSON   `json:"res" gorm:"column:res"`
	Url        string           `json:"url" gorm:"column:url"`
	Uri        string           `json:"uri" gorm:"column:uri"`
	Method     string           `json:"method" gorm:"column:method"`
	StartTime  int64            `json:"start_time" gorm:"column:start_time"`
	ReqHeaders datatypes.JSON   `json:"req_headers" gorm:"column:req_headers"`
	ReqBody    datatypes.JSON   `json:"req_body" gorm:"column:req_body"`
	Created    jtime.TstampTime `json:"created" gorm:"column:created"`
	Latency    float64          `json:"latency" gorm:"column:latency"`
}

// TableName 设置表名
func (RequestLog) TableName() string {
	return "request_log"
}
